package cn.edu.swu.OOP;

public class Course {
    // 私有属性（封装课程信息，仅允许通过类内方法访问）
    private String courseId;
    private String courseName;
    private String teacher;

    // 无参构造方法   *作用：创建一个空的Course对象，属性值为默认值（null）
    //              * 后续可通过setter方法设置具体属性值
    public Course() {
    }

    // 带参构造方法    * 作用：创建Course对象时直接初始化所有属性
    public Course(String courseId, String courseName, String teacher) {
        this.courseId = courseId;
        this.courseName = courseName;
        this.teacher = teacher;
    }

    // getter和setter方法
    public String getCourseId() {
        return courseId;
    }

    public void setCourseId(String courseId) {
        this.courseId = courseId;
    }

    public String getCourseName() {
        return courseName;
    }

    public void setCourseName(String courseName) {
        this.courseName = courseName;
    }

    public String getTeacher() {
        return teacher;
    }

    public void setTeacher(String teacher) {
        this.teacher = teacher;
    }

    // 展示课程信息
    public void showInfo() {
        System.out.println("===== 课程信息 =====");
        System.out.println("课程编号: " + courseId);
        System.out.println("课程名称: " + courseName);
        System.out.println("任课教师: " + teacher);
        System.out.println("===================");
    }
}
